package a01demo1;

import java.util.Arrays;
import java.util.Comparator;

public class Test1 {
    public static void main(String[] args) {
        Integer[] arr = {3, 9, 1, 5};
        Arrays.sort(arr, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2 - o1;
            }
        });
        System.out.println(Arrays.toString(arr));

        Arrays.sort(arr, (o1, o2) -> o2 - o1);
        System.out.println(Arrays.toString(arr));

        Arrays.sort(arr,Test1::subtraction);
        System.out.println(Arrays.toString(arr));
    }
    public static int subtraction(int a,int b){
        return a-b;
    }
}
